<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .c1 {
        border: 20px solid red;
        opacity: 0.5;
        width: 120px;
        height: 120px;
      }

      .c2 {
        opacity: 0.1;
      }
    </style>
    <script src="./js/jquery-3.6.0.js"></script>
  </head>
  <body>
    <img src="./images/1.jpg" alt="" />
    <hr />
    <button>添加样式</button>
    <button>获得样式</button>
    <button>移除样式</button>
    <button>切换样式</button>
  </body>
</html>
<script>
  $('button:eq(0)').click(function () {
    $('img').addClass('c1')
  })

  $('button:eq(1)').click(function () {
    console.log($('img').css('border'))
  })

  $('button:eq(2)').click(function () {
    $('img').removeClass('c1')
  })

  $('button:eq(3)').click(function () {
    $('img').toggleClass('c2')
  })
</script>
